package webservices;

import entity.Utente;
import entity.Wish;
import java.util.List;
import javax.ejb.EJB;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ejb.Stateless;
import session.UtenteFacadeRemote;

/**
 *
 * @author Fabio
 */
@WebService()
@Stateless()
public class LoginShare {
    @EJB
    private UtenteFacadeRemote ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "create")
    @Oneway
    public void create(@WebParam(name = "utente")
    Utente utente) {
        ejbRef.create(utente);
    }

    @WebMethod(operationName = "edit")
    @Oneway
    public void edit(@WebParam(name = "utente")
    Utente utente) {
        ejbRef.edit(utente);
    }

    @WebMethod(operationName = "remove")
    @Oneway
    public void remove(@WebParam(name = "utente")
    Utente utente) {
        ejbRef.remove(utente);
    }

    @WebMethod(operationName = "find")
    public Utente find(@WebParam(name = "username")
    String username) {
        return ejbRef.find(username);
    }

    @WebMethod(operationName = "findAll")
    public List<Utente> findAll() {
        return ejbRef.findAll();
    }

    @WebMethod(operationName = "findRange")
    public List<Utente> findRange(@WebParam(name = "range")
    int[] range) {
        return ejbRef.findRange(range);
    }

    @WebMethod(operationName = "count")
    public int count() {
        return ejbRef.count();
    }

    @WebMethod(operationName = "exists")
    public boolean exists(@WebParam(name = "utente")
    Utente utente) {
        return ejbRef.exists(utente);
    }

    @WebMethod(operationName = "carica")
    public Utente carica(@WebParam(name = "username")
    String username, @WebParam(name = "password")
    String password) {
        return ejbRef.carica(username, password);
    }

    @WebMethod(operationName = "aggiungiAmico")
    @Oneway
    public void aggiungiAmico(@WebParam(name = "utente")
    String utente, @WebParam(name = "amico")
    String amico) {
        ejbRef.aggiungiAmico(utente, amico);
    }

    @WebMethod(operationName = "getOrderedUserWishList")
    public List<Wish> getOrderedUserWishList(@WebParam(name = "username")
    String username) {
        return ejbRef.getOrderedUserWishList(username);
    }

    @WebMethod(operationName = "cercaAmici")
    public List<Utente> cercaAmici(@WebParam(name = "currentUsername")
    String currentUsername, @WebParam(name = "username")
    String username, @WebParam(name = "nome")
    String nome, @WebParam(name = "cognome")
    String cognome, @WebParam(name = "email")
    String email, @WebParam(name = "soloAmici")
    boolean soloAmici) {
        return ejbRef.cercaAmici(currentUsername, username, nome, cognome, email, soloAmici);
    }

    @WebMethod(operationName = "aggiungiDesiderio")
    public boolean aggiungiDesiderio(@WebParam(name = "username")
    String username, @WebParam(name = "item_id")
    Long item_id, @WebParam(name = "priority")
    Integer priority, @WebParam(name = "voto")
    Integer voto) {
        return ejbRef.aggiungiDesiderio(username, item_id, priority, voto);
    }

    @WebMethod(operationName = "creaDesiderio")
    public boolean creaDesiderio(@WebParam(name = "username")
    String username, @WebParam(name = "categoryId")
    Long categoryId, @WebParam(name = "descrizione")
    String descrizione, @WebParam(name = "proiority")
    Integer proiority, @WebParam(name = "voto")
    Integer voto) {
        return ejbRef.creaDesiderio(username, categoryId, descrizione, proiority, voto);
    }
}
